<template>
  <div class='student'>
    <Search btns="2-1" :searchData="searchData" :search="search"></Search>
    <Table btns="2-3-1" :tableData="tableData" :tableTotable="true" :data0="data" :params="pageInfo" :search="search" :pageSize="15"></Table>
    <p style="display:none">{{getData}}</p>
  </div>
</template>
<script>
import Search from "../common/search"
import Table from "../common/table"
export default {
  components: {Search,Table},
  name: "",
  data() {
    return {
      search:{
        name:"",
        cet4:"",
        cet6:"",
        computers:"",
        scholarship_state:"",
        scholarship_remarkable:"",
        scholarship_inspirational:"",
        scholarship_school:"",
        scholarship_society:"",
        difficulty_study:"",
        difficulty_family:"",
        difficulty_economics:"",
        difficulty_network:"",
        subsidies_first:"",
        subsidies_second:"",
        subsidies_third:"",
        subsidies_society:"",
        excellent_pacesetter:"",
        excellent_school_student:"",
        excellent_school_cadre:"",
        excellent_faculty_student:"",
        excellent_faculty_cadre:"",
        excellent_graduate:"",
      },
      pageInfo:{
        page:1,
        total:0,
      },
      searchData:[
        {name:"学院",key:"college",type:"select",array:[]},
        {name:"学生类型",key:"type",type:"select",array:["本科生","研究生"]},
        {name:"专业",key:"specialty",type:"select",array:[]},
        {name:"班级",key:"grade",type:"select",array:[]},
        {name:"学号",key:"number",type:"input"},
        {name:"姓名",key:"name",type:"input"},
        {name:"任职",key:"position",type:"select",array:[]},
        {name:"学生状态",key:"sta",type:"select",array:[]},
        {name:"身份证号",key:"identitycard",type:"input"},
        {name:"QQ",key:"qq",type:"input"},
        {name:"技能证书",key:"sepcialSelect_0",type:"select",array:[{label:"CET4",value:"cet4"},{label:"CET6",value:"cet6"},{label:"计算机过级情况",value:"computers"},]},
        {name:"荣获奖学金",key:"sepcialSelect_1",type:"select",array:[{label:"国家奖学金",value:"scholarship_state"},{label:"卓越奖学金",value:"scholarship_remarkable"},{label:"国家励志奖学金",value:"scholarship_inspirational"},{label:"学校奖学金",value:"scholarship_school"},{label:"社会奖学金",value:"scholarship_society"}  ]},
        {name:"困难类型",key:"sepcialSelect_2",type:"select",array:[{label:"学习困难",value:"difficulty_study"},{label:"家庭重大变故",value:"difficulty_family"},{label:"经济困难",value:"difficulty_economics"},{label:"沉溺网络",value:"difficulty_network"},]},
        // {name:"是否贫困生",key:"",type:"select",array:["是","否"]},
        {name:"贫困等级",key:"difficulty_class",type:"select",array:[]},
        {name:"助学金",key:"sepcialSelect_3",type:"select",array:[{label:"国家一等助学金",value:"subsidies_first"},{label:"国家二等助学金",value:"subsidies_second"},{label:"国家三等助学金",value:"subsidies_third"},{label:"社会助学金",value:"subsidies_society"}]},
        {name:"荣获称号",key:"honorary",type:"select",array:[{label:"校三好学生标兵",value:"校三好学生标兵"},{label:"校三好学生",value:"校三好学生"},{label:"校优秀学生干部",value:"校优秀学生干部"},{label:"院三好学生",value:"院三好学生"},{label:"院优秀学生干部",value:"院优秀学生干部"},{label:"优秀毕业生",value:"优秀毕业生"}]},
        {name:"是否入党",key:"party",type:"select",array:["是","否"]},
        {name:"是否上过党校",key:"partyschool",type:"select",array:["是","否"]},
      ],
      tableData:[
        {
          label:"基本信息",
          data:[
            {label:"学院",props:"college",width:""},
            {label:"学生类型",props:"type",width:""},
            {label:"专业",props:"specialty",width:""},
            {label:"班级",props:"grade",width:""},
            {label:"学号",props:"number",width:""},
            {label:"姓名",props:"name",width:""},
            {label:'学生状态',props:'sta'},
            {label:"性别",props:"sex",width:""},
            {label:"出生年月",props:"birth",width:""},
            {label:"政治面貌",props:"status",width:""},
            {label:"民族",props:"nation",width:""},
            {label:"任职",props:"position",width:"200"},
            {label:"任职期间",props:"position_time",width:""},
            {label:"住宿楼栋",props:"dormitory",width:""},
            {label:"宿舍号",props:"dormitory_number",width:""},
            {label:"身份证号",props:"identitycard",width:"200"},
            {label:"本科学校",props:"school",width:""},
            {label:"导师",props:"teacher",width:""},
            {label:"生源地区",props:"studentsin",width:""},
            {label:"毕业中学",props:"middleschool",width:""},
            {label:"联系电话",props:"tel",width:""},
            {label:"工行联名卡卡号",props:"bankcard",width:"200"},
            {label:"QQ",props:"qq",width:""},
            {label:"微信",props:"weixin",width:""},
            {label:"常用电子邮箱",props:"mail",width:""},
            {label:"家庭详细地址",props:"address",width:"250"},
            {label:"邮政编码",props:"postal",width:""},
          ]
        },{
          label:"技能证书",
          data:[
            {label:"CET4",props:"cet4",width:""},
            {label:"CET6",props:"cet6",width:""},
            {label:"计算机过级情况",props:"computers",width:""},
          ]
        },{
          label:"荣获奖学金",
          data:[
            {label:"国家奖学金",props:"scholarship_state",width:""},
            {label:"卓越奖学金",props:"scholarship_remarkable",width:""},
            {label:"国家励志奖学金",props:"scholarship_inspirational",width:""},
            {label:"学校奖学金",props:"scholarship_school",width:""},
            {label:"社会奖学金",props:"scholarship_society",width:""},
          ]
        },{
          label:"困难类型",
          data:[
            {label:"学习困难",props:"difficulty_study",width:""},
            {label:"家庭重大变故",props:"difficulty_family",width:""},
            {label:"经济困难",props:"difficulty_economics",width:""},
            {label:"沉溺网络",props:"difficulty_network",width:""},
          ]
        },{
          label:"贫困状况和助学金",
          data:[
            // {label:"贫困生",props:"difficulty_is",width:""},
            {label:"贫困等级",props:"difficulty_class",width:""},
            {label:"国家一等助学金",props:"subsidies_first",},
            {label:"国家二等助学金",props:"subsidies_second",},
            {label:"国家三等助学金",props:"subsidies_third",},
            {label:"社会助学金",props:"subsidies_society",width:""},
          ]
        },{
          label:"荣誉称号",
          data:[
            {label:"荣誉称号",props:"honorary",},
            // {label:"校三好学生标兵",props:"excellent_pacesetter",},
            // {label:"校三好学生",props:"excellent_school_student",},
            // {label:"校优秀学生干部",props:"excellent_school_cadre",},
            // {label:"院三好学生",props:"excellent_faculty_student",},
            // {label:"院优秀学生干部",props:"excellent_faculty_cadre",},
            // {label:"优秀毕业生",props:"excellent_graduate"},
          ]
        },{
          label:"党员发展",
          data:[
            {label:"是否入党",props:"party",width:""},
            {label:"入党时间",props:"party_time",width:""},
            {label:"是否转正",props:"official",width:""},
            {label:"转正时间",props:"official_time",width:""},
            {label:"是否团员推优",props:"party_excellent",width:""},
            {label:"团员推优时间",props:"party_excellent_time",width:""},
            {label:"是否上过党校",props:"partyschool",width:""},
            {label:"上党校时间",props:"partyschool_time",width:""},
          ]
        },{
          label:"联系人信息",
          data:[
            {label:"父亲姓名",props:"father",width:""},
            {label:"父亲工作单位",props:"father_unit",width:""},
            {label:"父亲联系方式",props:"father_tel",width:""},
            {label:"母亲姓名",props:"mother",width:""},
            {label:"母亲工作单位",props:"mother_unit",width:""},
            {label:"母亲联系方式",props:"mother_tel",width:""},
          ]
        }
      ],

      // 列表数据
      data:[],
      settime:null
    };
  },
  computed:{
    getData(){
      if(this.settime)clearTimeout(this.settime)
      var params={...this.search,...{page:this.pageInfo.page}}
      this.settime=setTimeout(()=>{
        this.getList(params)
        return true
      },500)
    },
  },
  methods: {
    getList(params){
      var goal=params||{...this.search,...this.pageInfo}
      delete goal.sepcialSelect_0
      delete goal.sepcialSelect_1
      delete goal.sepcialSelect_2
      delete goal.sepcialSelect_3
      delete goal.sepcialSelect_4
      
      _g.apiPost("studentinfo/lists",goal,true).then(res=>{
        this.$set(this,"data",res.data.list)
        this.pageInfo.total=res.data.total
      })
    },
    getSelectData(){
      _g.apiPost('Studentinfo/getwhere').then(res=>{
        this.$set(this.searchData[0],'array',res.data.college)
        this.$set(this.searchData[1],'array',res.data.type)
        this.$set(this.searchData[2],'array',res.data.specialty)
        this.$set(this.searchData[3],'array',res.data.grade)
        this.$set(this.searchData[6],'array',res.data.position)
        this.$set(this.searchData[7],'array',res.data.sta)
        this.$set(this.searchData[13],'array',res.data.difficulty_class)

        this.$store.state.dia.export.info=res.data.exportWhere
      })
    }
  },
  created() {
    this.getSelectData()
    if(bus._events.flash!==null){
      bus.$off("flash")
    }
    bus.$on("flash",(params)=>{
      // this.pageInfo.page=1
      this.getList(params)
    })
  },
};
</script>
<style scoped>
.student {
  background-color: #fff;
}
</style>